package com.nbsaas.boot;

import java.security.MessageDigest;
import java.util.Base64;

public class HashFunctionExample {
    public static void main(String[] args) throws Exception {
        MessageDigest digest = MessageDigest.getInstance("SHA-256");

        // 计算哈希值
        byte[] hashedData = digest.digest("Hello, Hash Function!".getBytes());
        String hashedBase64 = Base64.getEncoder().encodeToString(hashedData);
        System.out.println("Hashed: " + hashedBase64);
    }
}
